<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns="http://www.w3.org/1999/xhtml"
                template="./tpl/template.xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

    <ui:define name="title">
        Регистрация
    </ui:define>   

    <ui:define name="left">
        <ul class="nav nav-sidebar">
            <li><a href="./index.xhtml">Главная</a></li>                      
            <li><a href="./login.xhtml">Вход</a></li>
            <li><a href="./help.xhtml">Помощь</a></li>
        </ul>
    </ui:define>

    <ui:define name="content">
        <h1>Регистрация нового пользователя</h1>
        
        <c:forEach var="item" items="#{registrationView.errors}">
            <div class="panel panel-danger">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                <div class="panel-heading">
                    <strong>Предупреждение!</strong>
                </div>
                <div class="panel-body">#{item}</div>
            </div>
        </c:forEach>        
        <div class="well">
            <f:view>
                <h:form enctype="multipart/form-data">
                    
                              
                <table class="table table-responsive">
                    <tr>
                        <td>
                            Имя:
                        </td>
                        <td>
                            <h:inputText id="fname" class="form-control" value ="#{registrationView.fname}" required="true"></h:inputText> 
                            <h:message for="fname" style="color:red" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Фамилия:
                        </td>
                        <td>
                            <h:inputText id="lname" class="form-control" value ="#{registrationView.lname}" required="true"></h:inputText>
                            <h:message for="lname" style="color:red" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Email:
                        </td>
                        <td>
                            <h:inputText id="email" class="form-control" value ="#{registrationView.email}" required="true"></h:inputText>
                            <h:message for="email" style="color:red" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Пароль:
                        </td>
                        <td>
                            <h:inputText id="password" class="form-control" value ="#{registrationView.password}" required="true"></h:inputText>
                            <h:message for="password" style="color:red" />
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            Отправить:
                        </td>
                        <td>
                            <h:commandButton action="#{registrationView.postUser()}"  class="btn btn-success" value="Отправить"></h:commandButton>
                        </td>
                    </tr>
                </table>
            </h:form>
            </f:view>
        </div>
    </ui:define>

</ui:composition>
